package com.cskaoyan.bean.wx_brand.base;


import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;

/**
 * @author liXiaoFei
 * @date 2021/10/18 19:59
 */
@Data
public class BrandPageData<T> {

    Integer limit;
    Integer page;
    Integer pages;
    Integer total;
    List<T> list;

    public static <T> BrandPageData ok(List<T> pageData){
        PageInfo<T> advertisingPageInfo = new PageInfo<>(pageData);
        BrandPageData<T> data = new BrandPageData<>();
        data.setPage(advertisingPageInfo.getPageNum());
        data.setLimit(advertisingPageInfo.getPageSize());
        data.setPages(advertisingPageInfo.getPages());
        data.setTotal((int) advertisingPageInfo.getTotal());
        data.setList(pageData);
        return data;
    }
}
